# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=gcat
pkgver=29.39b266c
pkgrel=3
groups=('blackarch' 'blackarch-malware' 'blackarch-exploitation')
arch=('any')
pkgdesc='A fully featured backdoor that uses Gmail as a C&C server.'
url='https://github.com/byt3bl33d3r/gcat'
license=('custom:unknown')
depends=('python2' 'python2-argparse')
makedepends=('git')
source=("git+https://github.com/byt3bl33d3r/$pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
	cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a * "$pkgdir/usr/share/$pkgname"

  rm LICENSE README.md

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/$pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

